<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
</head>

<body>
  <script>
    //           输入例子：
    //   the	sky	is												blue!
    //   输出例子：
    //   blue! is sky the
    function fn(string) {
      for (let i = 0; i < string.length - 1; i++) {
        while (string[i] === "\t" && string[i + 1] === "\t") {
          string = string.substring(0, i + 1) + string.substring(i + 2);
        }
      }
      console.log(string);
      let arr = string.split("\t").reverse();
      console.log(arr);
      return arr.join("\t");
    }
    console.log(fn("   the	sky	is												blue!"));
  </script>
</body>

</html>